/*
 * acm2402.c
 *
 *  Created on: 28 Mar 2010
 *      Author: xuxu
 */

#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int main()
{
	double num[11][2010];
	int count,con;
	int i,j,k;
	double total;
	int t;
	int n,m;
	scanf("%d",&count);
	memset(num,0,sizeof(num));
	for(i=1;i<=2000;i++)
	{
		num[1][i]=1;
	}
	for(i=2;i<=10;i++)
	{
		for(j=1;j<=2000;j++)
		{
			t=j/2;
			total=0;
			for(k=1;k<=t;k++)
			{
				total+=num[i-1][k];
			}
			num[i][j]=total;
		}
	}
	con=1;
	while(count--)
	{
		scanf("%d%d",&n,&m);
		total=0;
		for(i=1;i<=m;i++)
			total+=num[n][i];
		printf("Case %d: n = %d, m = %d, # lists = %.0lf\n",con++,n,m,total);
	}
	return 0;
}
